package com.zxy.feiclients;

import com.zxy.feiclients.fallback.AccountFallback;
import com.zxy.result.CommonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;

@FeignClient(value = "account-service-client",fallbackFactory = AccountFallback.class)
public interface AccountService {

    /**
     * 调用账户微服务做账户的余额的扣减操作
     * @param userId 用户id
     * @param money 需要扣除的金额
     */
    @PostMapping(value = "/account/decrease")
    CommonResult decrease(@RequestParam("userId") Long userId,
                          @RequestParam("money") BigDecimal money);
}
